package com.sunny.excel.config;

import com.sunny.excel.config.resolver.ExcelFileArgumentResolver;
import com.sunny.excel.config.resolver.MultiSheetExcelFileArgumentResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

import java.util.List;

/**
 * @Author:shucq
 * @Description:
 * @Date 2019/10/25 18:04
 */
public class ExcelFileArgumentResolverConfig extends WebMvcConfigurationSupport {
    @Override
    public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
        argumentResolvers.add(excelFileArgumentResolver());
        argumentResolvers.add(multiSheetExcelFileArgumentResolver());
        super.addArgumentResolvers(argumentResolvers);
    }

    @Bean
    public ExcelFileArgumentResolver excelFileArgumentResolver() {
        return new ExcelFileArgumentResolver();
    }

    /**
     * excel 多 Sheet上传
     * @return
     */
    @Bean
    public MultiSheetExcelFileArgumentResolver multiSheetExcelFileArgumentResolver() {
        return new MultiSheetExcelFileArgumentResolver();
    }


}
